﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtaAPIClient.XhDoOrderService;
using GtaAPIClient.XhDoQueryService; 
using GtaAPIClient.TransactionManage; 
using GtaAPIClient.DoRZRJOrderService;
using GtaAPIClient.DoRZRJQueryService;
using GtaAPIClient.WcfRZRJBasicProviderService;
using GtaAPIClient.CounterComprehensiveService;


namespace GtaAPIClient
{
    interface WcfService
    {
        /// <summary>
        /// 增加资金
        /// </summary>
        /// <param name="outMessage"></param>
        /// <param name="addCapitalEntity"></param>
        /// <returns></returns>
        bool fundTransfer(out string outMessage, int tradeId, int fromCapitalAccountType, int toCapitalAccountType, decimal transferAmount, int currencyType);

        /// <summary>
        /// 交易员开户批量开户，用户名和密码为空
        /// </summary>
        /// <param name="outMessage"></param>
        /// <param name="number"></param>
        /// <param name="inifund"></param>
        /// <param name="loginName"></param>
        /// <param name="loginPswd"></param>
        /// <returns></returns>
        TransactionManage.UM_UserInfo[] batchOpenAccount(out string outMessage, int number, InitFund inifund, string loginName, string loginPswd);

        /// <summary>
        /// 单个交易员开户，可以指定用户名与密码
        /// </summary>
        /// <param name="outMessage"></param>
        /// <param name="number"></param>
        /// <param name="inifund"></param>
        /// <param name="loginName"></param>
        /// <param name="loginPswd"></param>
        /// <returns></returns>
        TransactionManage.UM_UserInfo openAccount(out TransactionManage.AccountEntity[] accountEntitys, out string outMessage, TransactionManage.UM_UserInfo userInfo, InitFund inifund, string mloginName, string mloginPswd);

        /// <summary>
        /// 查询交易员各种账号
        /// </summary>
        /// <param name="message"></param>
        /// <param name="accountType"></param>
        /// <param name="traderId"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        AccountFindResultEntity[] findAccount(out string message, int accountType, string traderId, string password);


        /**************************行情*******************************/
        MarketDataLevel getStockQuotation(out string errMsg, string code, int breedClassType);


        /**************************现货*******************************/
        OrderResponse doOrder(XhDoOrderService.StockOrderRequest stockOrderReq);

        bool cancelOrder(string orderId, ref string message, out GTTypesOrderStateType ost);

        long getMaxOrderAmount(out string outMessage, string TraderId, float OrderPrice, string Code, CounterComprehensiveService.GTTypesOrderPriceType orderPriceType);

        //XH_TodayEntrustTableInfo[] queryOrder(out int count, string capitalAccount, string strPassword, SpotEntrustConditionFindEntity cond, int start, int page, ref string errorMessage);

        DoCommonQuery.XH_TodayEntrustTableInfo[] queryOrder(out int total, out string errorMessage, string userID, string pwd, int accountType, DoCommonQuery.SpotEntrustConditionFindEntity filter, DoCommonQuery.PagingInfo pageInfo);

        XH_HistoryEntrustTableInfo[] queryHistoryOrder(out int count, out string errorMessage, string capitalAccount, string strPassword, int start, int page, SpotEntrustConditionFindEntity cond);

        XH_TodayTradeTableInfo[] queryTrade(out int count, out string strErrorMessage, string capitalAccount, string strPassword, int start, int page, SpotTradeConditionFindEntity cond);

        XH_HistoryTradeTableInfo[] queryHistoryTrade(out int count, out string strErrorMessage, string capitalAccount, string strPassword, int start, int page, SpotTradeConditionFindEntity cond);

        SpotHoldFindResultEntity[] queryHold(out int count, string capitalAccount, string strPassword, SpotHoldConditionFindEntity cond, int start, int page, ref string strErrorMessage);

        XhDoQueryService.SpotCapitalEntity getSpotCapital(string strFundAccountId, XhDoQueryService.TypesCurrencyType currencyType, string userPassword, ref string strErrorMessage);

        //获得用户所有账号的资产信息，目前还未用到
        XhDoQueryService.AssetSummaryEntity[] getAssetsSummary(out string outMessage, string traderId, string password);
        
        /**************************股指期货*******************************/
        OrderResponse doIfOrder(XhDoOrderService.StockIndexFuturesOrderRequest futuresorder);

        bool cancelIfOrder(string orderId, ref string message, out GTTypesOrderStateType ost);

        long getIfMaxOrderAmount(out string outMessage, string TraderId, float OrderPrice, string Code, CounterComprehensiveService.GTTypesOrderPriceType orderPriceType);

        decimal getIfTradeFee(out string errMsg, CounterComprehensiveService.StockIndexFuturesOrderRequest stockorder);

        QH_TodayEntrustTableInfo[] queryIfOrder(out int count, string capitalAccount, string strPassword, FuturesEntrustConditionFindEntity cond, int start, int page, ref string errorMessage);

        QH_HistoryEntrustTableInfo[] queryIfHistoryOrder(out int count, string capitalAccount, string strPassword, FuturesEntrustConditionFindEntity cond, int start, int page, ref string errorMessage);

        QH_TodayTradeTableInfo[] queryIfTrade(out int count, out string strErrorMessage, string capitalAccount, string strPassword, int start, int page, FuturesTradeConditionFindEntity cond);

        QH_HistoryTradeTableInfo[] queryIfHistoryTrade(out int count, string capitalAccount, string strPassword, FuturesTradeConditionFindEntity cond, int start, int page, ref string strErrorMessage);

        FuturesHoldFindResultEntity[] queryIfHold(out int count, string capitalAccount, string strPassword, FuturesHoldConditionFindEntity cond, int start, int page, ref string strErrorMessage);

        XhDoQueryService.FuturesCapitalEntity getIfCapital(string strFundAccountId, XhDoQueryService.TypesCurrencyType currencyType, string userPassword, ref string strErrorMessage);

        DoCommonQuery.FuturesCapitalEntity getIfCapital2(string userId, int accountType, DoCommonQuery.TypesCurrencyType currencyType, string userPassword, ref string strErrorMessage);

        /**************************融资融券*******************************/
        RZRJOrderResponse rzrjDoOrder(DoRZRJOrderService.RZRJOrderRequest orderInfo);

        bool rzrjCancelOrder(string orderId, ref string message);

        RZRJ_TodayEntrust[] getRzrjTodayOrder(out int total, out string errorMsg, string userID, string pwd, RZRJEntrustConditionFindEntity cond, DoRZRJQueryService.PagingInfo pageInfo);

        RZRJ_HistoryEntrust[] getRzrjHistoryOrder(out int total, out string errorMsg, string userID, string pwd, RZRJEntrustConditionFindEntity cond, DoRZRJQueryService.PagingInfo pageInfo);

        RZRJ_TodayTrade[] getRzrjTodayTrade(out int total, out string errorMsg, string userID, string pwd, RZRJTradeConditionFindEntity cond, DoRZRJQueryService.PagingInfo pageInfo);

        RZRJ_HistoryTrade[] getRzrjHistoryTrade(out int total, out string errorMsg, string userID, string pwd, RZRJTradeConditionFindEntity cond, DoRZRJQueryService.PagingInfo pageInfo);

        RZRJHoldFindResultEntity[] getRzrjAccountHoldDetail(out int count, string userId, string strPassword, RZRJHoldConditionFindEntity cond, int start, int pageLength, ref string strErrorMessage);

        RZRJ_HoldAccount[] getRzrjAccountHoldSimple(out string errorMsg, string userID, QueryTypeQueryCurrencyType currencytype);

        RZRJCapitalEntity getRzrjCapital(string strFundAccountId, int currencyType, string userPassword, ref string strErrorMessage);

        DoRZRJQueryService.RZRJ_Liabilities[] getUnclosedRzLiabilities(out int total, out string errorMsg, string userID, string pwd, RZRJLiabilitiesFindEntity cond, DoRZRJQueryService.PagingInfo pagingInfo);

        DoRZRJQueryService.RZRQ_LiabilitiesHistory[] getClosedRzLiabilities(out int total, out string errorMsg, string userID, string pwd, RZRJLiabilitiesFindEntity cond, DoRZRJQueryService.PagingInfo pagingInfo);

        DoRZRJQueryService.RZRJ_RJLiabilities[] getUnclosedRjLiabilities(out int total, out string errorMsg, string userID, string pwd, RZRJLiabilitiesFindEntity cond, DoRZRJQueryService.PagingInfo pagingInfo);

        DoRZRJQueryService.RZRQ_RQLiabilitiesHistory[] getClosedRjLiabilities(out int total, out string errorMsg, string userID, string pwd, RZRJLiabilitiesFindEntity cond, DoRZRJQueryService.PagingInfo pagingInfo);

        RZRQComputerResultEntity getTradeMaxAmount(out string errMsg, RZRQComputeAmount result); 

        RZRQCreditAssetsEntity getRzrjCreditAsset(out string errorMsg, string userID, string pwd, int currencyType);

        RZRJ_CapitalExtendTable[] getRzrjCapitalExtendTable(out string errorMsg, string userId, string userPassword, int currencyType);

        bool getMaintainGuarantyRatio(out decimal maintainGuarantyRatio, out string errorMsg, string userID, string pwd, int currencyType);

        /*****标的物*****/
        RZRJ_BourseUnderlyingCode[] getRzrjUnderLyingList(out int total, out string message, string code, MPagingInfo pagingInfo);

        bool isUnderLyingStock(out string message, string code);

        RZRJ_SecurityUnderlyingCode[] getRzrjCompanyUnderLyingList(out int total, out string msg, int securityCompanyID, string code, MPagingInfo pagingInfo);

        RZRJ_SecurityUnderlyingCode[] getRzrjCompanyUnderLyingCode(int securityCompanyID, string code);

        /*****担保品******/
        RZRJ_BourseMortagagedCode[] getRzrjMortagageList(out int total, out string message, string code, int codeBelongBourse, int priorLevel, MPagingInfo pagingInfo);

        bool isMortagageStock(out string message, string code);

        RZRJ_SecurityMortagagedCode[] getRzrjCompanyMortagageList(out int total, out string msg, string code, int securityCompanyID, MPagingInfo pagingInfo);

        /*****开户*****/
        int addRzrjBasicInfo(out string msg, RZRJ_TraderBasicInfo[] traderBasicInfoList);

        bool addRzrjCreditLimit(out string msg, WcfRZRJBasicProviderService.RZRJ_PersonLimitCredit[] modelList, int[] userIdList);

        bool modifyRzrjCreditLimit(ref string msg, WcfRZRJBasicProviderService.RZRJ_PersonLimitCredit[] modelList);

        bool rzrjFundTransfer(out string outMessage, WcfRZRJBasicProviderService.FreeTransferEntity freeTransfer, WcfRZRJBasicProviderService.TypesCurrencyType currencyType);

    }
}
